var text_page = {};

text_page.show = function ( id_page, dest_div )
{
	liwe.history.add_module ( "text_page", { _page: "show", id_page: id_page, dest_div: dest_div } );

	liwe.AJAX.easy ( { action: "text_page.ajax.get", id_page: id_page }, function ( v )
		{
			$( dest_div, v [ 'txt' ] );
		} );
};

text_page.event_dispatch = function ( dict, data )
{
        var page = dict.get ( '_page' );

        switch ( page )
        {
                case "show":
                        text_page.show ( dict [ 'id_page' ], dict [ 'dest_div' ] );
                        break;

                default:
                        console.error ( "text_page-dispatch" )
                        console.error ( dict );
        }
};

text_page.get = function ( id_page, cback )
{
	liwe.AJAX.easy ( { action: "text_page.ajax.get", 'id_page': id_page }, function ( v ) {
		cback && cback ( v );
	} );
};

liwe.history.set_listener ( text_page.event_dispatch, 'text_page' );
